<template>
	<view style="width: 100%;" class="content">
		<view style="width: 100%;" class="button">
			<button style="width: 100%;">搜索</button>
		</view>
		<view class="">
			{{datas}}
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[1,2,3,4,5],
				num:0
			};
		},
		methods:{
			fun(){
				uni.request({
				    url: 'https://api-hmugo-web.itheima.net/api/public/v1/categories', 
				    data: {},
				    success: (res) => {
				        console.log(res.data.message);
				        this.list = res.data.message;
				    }
				});
			}
		},
		onLoad() {
			this.fun()
		},
		computed:{
			datas(){
				return this.list[this.num].children
			}
		}
	}
</script>

<style lang="scss">
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	.img{
		width: 90%;
		height: 120px;
		background-color: red;
		margin: 10px;
		font-size: 30px;
		text-align: center;
		color: white;
	}
	.box{
		display: flex;
		width: 100%;
		box-sizing: border-box;
		
	}
	.box2{
		flex: 2;
		display: flex;
		flex-wrap: wrap;
		>view{
			width: 45%;
			box-sizing: border-box;
			height: 50px;
		}
	}
	.box3{
		width: 100%;
		box-sizing: border-box;
	}
	.box4{
		width: 30%;
		float: left;
		height: 80px;
		background-color: green;
		box-sizing: border-box;
		margin: 10px;
			&:nth-child(1){
				height: 180px;
			}
	}

</style>
